/*
 * Utils.cpp
 *
 *  Created on: 18 Jun 2011
 *      Author: allan
 */

#include "Utils.h"

// C++ includes
#include <algorithm>

const int ElectricalCharge(string speciesName)
{
	int zNegative = - std::count(speciesName.begin(), speciesName.end(), '-');
	int zPositive = + std::count(speciesName.begin(), speciesName.end(), '+');
	
	return (zNegative != 0) ? zNegative : 
	       (zPositive != 0) ? zPositive : 0;
}
